<?php

abstract class SQLInstruction {

    protected $entity;
    protected $alias;
    /**
     *
     * @var SQL\Criteria
     */
    protected $criteria;
    protected $columnValues = array();

    public function setRowData($column, $value) {
        switch (gettype($value)) {
            case 'boolean':
                $this->columnValues[$column] = $value ? 'TRUE' : 'FALSE';

            case 'integer':
            case 'double':
                $this->columnValues[$column] = $value;

            case 'string':
                $value = addslashes($value);
                $this->columnValues[$column] = "'{$value}'";

            case 'NULL':
            case 'array':
            case 'object':
            default:
                return 'NULL';
        }
    }

    public function setCriteria(SQLCriteria $criteria = null) {
        $this->criteria = $criteria;
    }

    final public function setEntity($entity, $alias = null) {
        $this->entity = $entity;
        $this->alias = $alias;
    }

    final public function getEntity() {
        return $this->entity;
    }

    abstract function getInstruction();
}

?>
